package com.aistar.service.impl;

import com.aistar.mapper.AncommMapper;
import com.aistar.pojo.Ancomm;
import com.aistar.pojo.AncommVO;
import com.aistar.service.AncommService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@Service
public class AncommServiceImpl implements AncommService {
     @Autowired
   private AncommMapper ancommMapper;

    @Override
    public Ancomm getById(Integer id) {
        return ancommMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<AncommVO> getByAncommId(Integer id) {
        List<Ancomm> ancommList= ancommMapper.selectByExampleWithBLOBs(null);
        List<AncommVO> ancommVOList=new ArrayList<>();
        for(Ancomm a:ancommList){

            if(a.getAncoTableId() == id){
                AncommVO ancommVO = new AncommVO();
                ancommVO.setAncomm(a);
                ancommVOList.add(ancommVO);
            }

        }
     return  ancommVOList;
    }
}
